<?php
/**
 * 管理员模块
 * 
 + ----------------------------------------------------- 
 * Date 2013-3-8
 + -----------------------------------------------------
 */
class AdminAction extends CommonAction {
	
	/**
	 * 默认编辑
	 */
	public function edit() {
		$model=M('Admin','cms_en_');
		$id = $_REQUEST[$model->getPk()];
		$data = $model->find($id);
		$this->assign('data', $data);
		$this->display('add');
	}
	
	/**
	 * 默认编辑保存编辑数据
	 */
	public function update() {
		$model=M('Admin','cms_en_');
		$data=array(
			'id'		=>	1,
			'username'	=> $_POST['username'],
		);
		if(!empty($_POST['password'])){
			$data['password']=strtoupper(md5(strtoupper(md5($_POST['password']))));
		}
		if (false !== $model->save($data)) {
			$this->success(L('编辑成功'),__APP__.'/'.GROUP_NAME.'/Public/main');
		} else {
			$this->error(L('编辑失败，或许你没做任何修改！'));
		}
	}
}

?>